﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Configuration;

namespace BHair.Report
{
    public partial class frmtianqibaobiao : WeifenLuo.WinFormsUI.Docking.DockContent
    {
        public frmtianqibaobiao()
        {
            InitializeComponent();
        }
        string constr = ConfigurationManager.ConnectionStrings["BHair.Properties.Settings.BHairDBConnectionString"].ConnectionString;
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(constr);
            conn.Open();
            DataTable dt = new DataTable();
            string sql =string.Format( "SELECT [id], [日期], [天气],[温度] FROM [BHairDB].[dbo].[天气] where 日期>='{0}' and 日期<='{1}'",dateTimePicker1.Text,dateTimePicker2.Text);

            SqlDataAdapter sda = new SqlDataAdapter(sql,conn);
            sda.Fill(dt);
            dataGridView1.DataSource = dt;
            conn.Close();
        }

        private void frmtianqibaobiao_Load(object sender, EventArgs e)
        {

        }
    }
}
